import axios from "axios";

axios.interceptors.request.use((config) => {
    if (localStorage.getItem("token")) {
        config.headers.token = localStorage.getItem("token");
    }
    return config;
});
axios.interceptors.response.use((res) => {
    if (res.status == 200) {
        const data = res.data;
        // token失效
        if (data.Code == -1) {
            //do some
        } else if (data.Code == -2) {
            // do some
        }
        return data;
    } else {
        return res;
    }
});